package com.example.Fragment;

import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.example.Base.BaseFragment;
import com.example.activity.AttentionActivity;
import com.example.activity.EditPersonalActivity;
import com.example.activity.FansActivity;
import com.example.activity.FeedBackActivity;
import com.example.activity.MessageActivity;
import com.example.activity.MyLikeActivity;
import com.example.activity.MyPostActivity;
import com.example.activity.SettingActivity;
import com.example.activity.voiceDemoActivity;
import com.example.administrator.olddoctor.MainActivity;
import com.example.administrator.olddoctor.R;
import com.example.tools.IAppCallBack;

import com.example.view.CircleImageView;

/**
 * 我的
 */
public class PersonalFragment  extends BaseFragment implements IAppCallBack ,View.OnClickListener{

    private TextView personal_user_name;
    private Button tx_person_login;
    private LinearLayout person_message ;
    private LinearLayout person_invitation;
    private LinearLayout person_participation;
    private LinearLayout person_opinion;
    private LinearLayout person_friend;
    private LinearLayout person_seeting;
    private LinearLayout attention_layout;
    private LinearLayout fans_layout;

    private Context context;
    private View view;
    private CircleImageView circleImageView;
    private MainActivity activity;
    private View redRoundImage;

    @Override
    public void onAttach(Activity activity) {
        super.onAttach(activity);
        this.activity = (MainActivity) activity;
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        context = MainActivity.allThis;
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        this.onCreate(savedInstanceState);
        view = inflater.inflate(R.layout.fragment_personal, container, false);
        init();
        return view;
    }

    public void init(){
        circleImageView = (CircleImageView) view.findViewById(R.id.circleImageView);
        person_message = (LinearLayout) view.findViewById(R.id.person_message);
        person_invitation = (LinearLayout) view.findViewById(R.id.person_invitation);
        person_participation = (LinearLayout) view.findViewById(R.id.person_participation);
        person_opinion = (LinearLayout) view.findViewById(R.id.person_opinion);
        person_friend = (LinearLayout) view.findViewById(R.id.person_friend);
        person_seeting = (LinearLayout) view.findViewById(R.id.person_seeting);
        personal_user_name = (TextView) view.findViewById(R.id.personal_user_name);
        tx_person_login = (Button) view.findViewById(R.id.tx_person_login);
        attention_layout = (LinearLayout) view.findViewById(R.id.attention_layout);
        fans_layout = (LinearLayout) view.findViewById(R.id.fans_layout);
        redRoundImage = (View) view.findViewById(R.id.redRoundImage);
        circleImageView.setOnClickListener(this);person_message.setOnClickListener(this);
        person_invitation.setOnClickListener(this);person_participation.setOnClickListener(this);
        person_opinion.setOnClickListener(this);person_friend.setOnClickListener(this);
        person_seeting.setOnClickListener(this);attention_layout.setOnClickListener(this);
        fans_layout.setOnClickListener(this);
    }

    @Override
    public void onSuccess(Object data, String sucText, String fucName) {

    }

    @Override
    public void onFailure(String errCode, String errText, String fucName) {

    }

    @Override
    public void onRequestStart() {

    }

    @Override
    public void onClick(View view) {

        switch (view.getId()){

            case R.id.circleImageView:
                fragmentgoActivity(context, EditPersonalActivity.class,null);
                break;

            case R.id.person_message:
                fragmentgoActivity(context, MessageActivity.class,null);
                break;

            case R.id.person_invitation:
                fragmentgoActivity(context, MyPostActivity.class,null);
                break;

            case R.id.person_participation:
                fragmentgoActivity(context, MyLikeActivity.class,null);
                break;

            case R.id.person_opinion:
                fragmentgoActivity(context, FeedBackActivity.class,null);
                break;

            case R.id.attention_layout:
                fragmentgoActivity(context, AttentionActivity.class,null);
                break;

            case R.id.fans_layout:
                fragmentgoActivity(context, FansActivity.class,null);
                break;

            case R.id.person_friend:
                fragmentgoActivity(context, voiceDemoActivity.class,null);
                break;

            case R.id.person_seeting:
                fragmentgoActivity(context, SettingActivity.class,null);
                break;

            case R.id.tx_person_login:

                break;
        }
    }
}
